\ProvidesClass{njustbeamer}[2023/10/18 v1.00 NJUST Beamer Template WeihaoBo@njust.edu.cn]
\NeedsTeXFormat{LaTeX2e}

% 这定义了文档的类为beamer，通常用于制作演示幻灯片。notheorems选项表示不自动加载beamer的定理环境，aspectratio=1610设置幻灯片的宽高比为16:9。
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}}
\ProcessOptions\relax
\LoadClass[notheorems, aspectratio=169]{beamer}
% aspectratio: 1610, 149, 54, 43(default), 32

\RequirePackage{ragged2e}
\RequirePackage{natbib}
\RequirePackage{latexsym}
\RequirePackage{amsmath,amssymb}
\RequirePackage{mathtools}
\RequirePackage{color,xcolor}
\RequirePackage{graphicx}
\RequirePackage{algorithm}
\RequirePackage{amsthm}
\RequirePackage{lmodern}
\RequirePackage[utf8]{inputenc}
\RequirePackage{CJKutf8}
\RequirePackage{animate}
\RequirePackage{lipsum}
\RequirePackage{ulem}
\RequirePackage{listings}
% ----------------------------------------------
% tikx
% 加载framed宏包，提供绘制框架的功能。
\RequirePackage{framed}
% 加载tikz宏包，支持复杂的图形绘制。
\RequirePackage{tikz}
% 加载pgf宏包，为tikz提供底层绘图支持。
\RequirePackage{pgf}


% 这行代码加载了多个tikz库，这些库提供了一系列额外的功能和工具，用于绘图。具体来说，它加载了以下库：
% calc：提供高级的坐标计算功能。
% trees：支持树状图的绘制。
% positioning：改进节点的定位方式。
% arrows：提供了各种箭头的样式。
% chains：用于创建链状结构。
% shapes.geometric：提供各种几何形状的节点。
% decorations.pathreplacing & decorations.pathmorphing：提供路径修饰功能。
% shapes：提供各种常见的形状。
% matrix：支持矩阵的绘制。
% shapes.symbols：提供符号形状的节点。
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}

% 设置随机数生成的种子为1。这样可以确保每次编译文档时产生的随机效果都是一样的，即得到的结果是可预测的。
\pgfmathsetseed{1} % To have predictable results
% Define a background layer, in which the parchment shape is drawn
% 定义一个名为background的新图层。在TiKZ中，图层用于确定各个图形元素的绘制顺序，这样一些元素可以显示在其他元素的上方或下方。
\pgfdeclarelayer{background}
% 设置图层的顺序。background图层位于main图层的下方，这意味着main图层上的元素会显示在background图层上的元素之上。
\pgfsetlayers{background,main}

\definecolor{njust}{HTML}{57247B}
% define styles for the normal border and the torn border
% \tikzset{
%   normal border/.style={njust, decorate, 
%      decoration={random steps, segment length=2.5cm, amplitude=.7mm}},
%   torn border/.style={njust, decorate, 
%      decoration={random steps, segment length=.5cm, amplitude=1.7mm}}}
     
% 定义了两种tikz样式：
% normal border：定义了一种用于边界的样式，这种样式的边界看起来是随机的，但变化较小，颜色为orange!30!black!10。
% torn border：定义了另一种用于边界的样式，这种样式的边界看起来像被撕裂的，颜色为orange!30!black!5。
% define styles for the normal border and the torn border
\tikzset{
  normal border/.style={orange!30!black!10, decorate, 
     decoration={random steps, segment length=2.5cm, amplitude=.7mm}},
  torn border/.style={orange!30!black!5, decorate, 
     decoration={random steps, segment length=.5cm, amplitude=1.7mm}}}




% Macro to draw the shape behind the text, when it fits completly in the
% page
% 定义了一个名为parchmentframe的宏，用于绘制一个完整的文稿背景。其中#1表示宏的输入参数，即要放入背景中的文本。背景使用normal border样式，表现为一个不规则边缘的矩形。
\def\parchmentframe#1{
\tikz{
  \node[inner sep=2em] (A) {#1};  % Draw the text of the node
  \begin{pgfonlayer}{background}  % Draw the shape behind
  \fill[normal border] 
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \end{pgfonlayer}}}

% 定义了一个宏，用于绘制文本在下一页将继续的情况的背景。除了常规背景之外，还在下方添加了一个使用torn border样式的不规则边缘。
% Macro to draw the shape, when the text will continue in next page
\def\parchmentframetop#1{
\tikz{
  \node[inner sep=2em] (A) {#1};    % Draw the text of the node
  \begin{pgfonlayer}{background}    
  \fill[normal border]              % Draw the ``complete shape'' behind
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \fill[torn border]                % Add the torn lower border
        ($(A.south east)-(0,.2)$) -- ($(A.south west)-(0,.2)$) -- 
        ($(A.south west)+(0,.2)$) -- ($(A.south east)+(0,.2)$) -- cycle;
  \end{pgfonlayer}}}

% 定义了一个宏，用于绘制文本从上一页继续的情况的背景。除了常规背景之外，还在上方添加了一个使用torn border样式的不规则边缘。
% Macro to draw the shape, when the text continues from previous page
\def\parchmentframebottom#1{
\tikz{
  \node[inner sep=2em] (A) {#1};   % Draw the text of the node
  \begin{pgfonlayer}{background}   
  \fill[normal border]             % Draw the ``complete shape'' behind
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \fill[torn border]               % Add the torn upper border
        ($(A.north east)-(0,.2)$) -- ($(A.north west)-(0,.2)$) -- 
        ($(A.north west)+(0,.2)$) -- ($(A.north east)+(0,.2)$) -- cycle;
  \end{pgfonlayer}}}
% 定义了一个宏，用于绘制文本既从上一页继续又在下一页继续的情况的背景。这种背景在上下都添加了torn border样式的不规则边缘。
% Macro to draw the shape, when both the text continues from previous page
% and it will continue in next page
\def\parchmentframemiddle#1{
\tikz{
  \node[inner sep=2em] (A) {#1};   % Draw the text of the node
  \begin{pgfonlayer}{background}   
  \fill[normal border]             % Draw the ``complete shape'' behind
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \fill[torn border]               % Add the torn lower border
        ($(A.south east)-(0,.2)$) -- ($(A.south west)-(0,.2)$) -- 
        ($(A.south west)+(0,.2)$) -- ($(A.south east)+(0,.2)$) -- cycle;
  \fill[torn border]               % Add the torn upper border
        ($(A.north east)-(0,.2)$) -- ($(A.north west)-(0,.2)$) -- 
        ($(A.north west)+(0,.2)$) -- ($(A.north east)+(0,.2)$) -- cycle;
  \end{pgfonlayer}}}

% 定义了一个新的环境parchment，这个环境用于在文稿中添加上述定义的背景。这个环境接受一个可选的标题参数，默认为"Example"。标题会显示在背景的顶部。在环境的开始，会选择适当的背景（完整、上半部、下半部或中间部分），在环境结束时，背景会被关闭。
% Define the environment which puts the frame
% In this case, the environment also accepts an argument with an optional
% title (which defaults to ``Example'', which is typeset in a box overlaid
% on the top border
% \newenvironment{parchment}[1][Example]{%
%   \def\FrameCommand{\parchmentframe}%
%   \def\FirstFrameCommand{\parchmentframetop}%
%   \def\LastFrameCommand{\parchmentframebottom}%
%   \def\MidFrameCommand{\parchmentframemiddle}%
%   \vskip\baselineskip
%   \MakeFramed {\FrameRestore}
%   \noindent\tikz\node[inner sep=1ex, draw=black!20,fill=white, 
%           anchor=west, overlay] at (0em, 2em) {\sffamily#1};\par}%
% {\endMakeFramed}

\newenvironment{parchment}[1][Example]{%
  \def\FrameCommand{\parchmentframe}%
  \def\FirstFrameCommand{\parchmentframetop}%
  \def\LastFrameCommand{\parchmentframebottom}%
  \def\MidFrameCommand{\parchmentframemiddle}%
  \vskip\baselineskip
  \MakeFramed {\FrameRestore}
  \noindent\tikz\node[inner sep=1ex, draw=black!20, fill=njust, text=white,
          anchor=west, overlay] at (0em, 2em) {\sffamily#1};\par}%
{\endMakeFramed}

% ----------------------------------------------
%这是设置Beamer模式为演示模式的指令。以下是在这个模式下的设置：
% \usetheme{CambridgeUS}：使用“CambridgeUS”主题。\usetheme{CambridgeUS}：使用“CambridgeUS”主题。
% \usecolortheme{beaver}：使用颜色主题“beaver”。
% \useoutertheme{infolines}：选择了一个外部主题“infolines”，这决定了幻灯片的头部和底部样式。
% \useinnertheme{circles}：选择了一个内部主题“circles”，这决定了幻灯片元素如何排列和样式化。
% \usecolortheme{beaver}：使用颜色主题“beaver”。
% \useoutertheme{infolines}：选择了一个外部主题“infolines”，这决定了幻灯片的头部和底部样式。
% \useinnertheme{circles}：选择了一个内部主题“circles”，这决定了幻灯片元素如何排列和样式化。
%%%%%%%%%%%%%%
\hypersetup{
    colorlinks,
    citecolor=blue,
    linkcolor=blue
}


%----------------------------------------------------------------------------------------
%	SELECT LAYOUT THEME
%----------------------------------------------------------------------------------------

% Beamer comes with a number of default layout themes which change the colors and layouts of slides. Below is a list of all themes available, uncomment each in turn to see what they look like.

%\usetheme{default}
%\usetheme{AnnArbor}
%\usetheme{Antibes}
%\usetheme{Bergen}
%\usetheme{Berkeley}
%\usetheme{Berlin}
%\usetheme{Boadilla}
%\usetheme{CambridgeUS}
%\usetheme{Copenhagen}
%\usetheme{Darmstadt}
%\usetheme{Dresden}
%\usetheme{Frankfurt}
%\usetheme{Goettingen}
%\usetheme{Hannover}
%\usetheme{Ilmenau}
%\usetheme{JuanLesPins}
%\usetheme{Luebeck}
\usetheme{Madrid}
%\usetheme{Malmoe}
%\usetheme{Marburg}
%\usetheme{Montpellier}
%\usetheme{PaloAlto}
%\usetheme{Pittsburgh}
%\usetheme{Rochester}
%\usetheme{Singapore}
%\usetheme{Szeged}
%\usetheme{Warsaw}

%----------------------------------------------------------------------------------------
%	SELECT COLOR THEME
%----------------------------------------------------------------------------------------

% Beamer comes with a number of color themes that can be applied to any layout theme to change its colors. Uncomment each of these in turn to see how they change the colors of your selected layout theme.

%\usecolortheme{albatross}
%\usecolortheme{beaver}
%\usecolortheme{beetle}
%\usecolortheme{crane}
%\usecolortheme{dolphin}
%\usecolortheme{dove}
%\usecolortheme{fly}
%\usecolortheme{lily}
%\usecolortheme{monarca}
%\usecolortheme{seagull}
\usecolortheme{seahorse}
%\usecolortheme{spruce}
%\usecolortheme{whale}
%\usecolortheme{wolverine}

%----------------------------------------------------------------------------------------
%	SELECT FONT THEME & FONTS
%----------------------------------------------------------------------------------------

% Beamer comes with several font themes to easily change the fonts used in various parts of the presentation. Review the comments beside each one to decide if you would like to use it. Note that additional options can be specified for several of these font themes, consult the beamer documentation for more information.

%\usefonttheme{default} % Typeset using the default sans serif font
\usefonttheme[onlymath]{serif} % Typeset using the default serif font (make sure a sans font isn't being set as the default font if you use this option!)
%\usefonttheme{structurebold} % Typeset important structure text (titles, headlines, footlines, sidebar, etc) in bold
%\usefonttheme{structureitalicserif} % Typeset important structure text (titles, headlines, footlines, sidebar, etc) in italic serif
%\usefonttheme{structuresmallcapsserif} % Typeset important structure text (titles, headlines, footlines, sidebar, etc) in small caps serif

%------------------------------------------------

% \usepackage{mathptmx} % Use the Times font for serif text
% \usepackage{palatino} % Use the Palatino font for serif text

%\usepackage{helvet} % Use the Helvetica font for sans serif text
% \usepackage[default]{opensans} % Use the Open Sans font for sans serif text
%\usepackage[default]{FiraSans} % Use the Fira Sans font for sans serif text
%\usepackage[default]{lato} % Use the Lato font for sans serif text

%----------------------------------------------------------------------------------------
%	SELECT INNER THEME
%----------------------------------------------------------------------------------------

% Inner themes change the styling of internal slide elements, for example: bullet points, blocks, bibliography entries, title pages, theorems, etc. Uncomment each theme in turn to see what changes it makes to your presentation.

%\useinnertheme{default}
\useinnertheme{circles}
%\useinnertheme{rectangles}
%\useinnertheme{rounded}
%\useinnertheme{inmargin}

%----------------------------------------------------------------------------------------
%	SELECT OUTER THEME
%----------------------------------------------------------------------------------------

% Outer themes change the overall layout of slides, such as: header and footer lines, sidebars and slide titles. Uncomment each theme in turn to see what changes it makes to your presentation.

%\useoutertheme{default}
%\useoutertheme{infolines}
%\useoutertheme{miniframes}
%\useoutertheme{smoothbars}
%\useoutertheme{sidebar}
%\useoutertheme{split}
%\useoutertheme{shadow}
%\useoutertheme{tree}
%\useoutertheme{smoothtree}

%\setbeamertemplate{footline} % Uncomment this line to remove the footer line in all slides
%\setbeamertemplate{footline}[page number] % Uncomment this line to replace the footer line in all slides with a simple slide count

%\setbeamertemplate{navigation symbols}{} % Uncomment this line to remove the navigation symbols from the bottom of all slides

% 设置 框架、block 等颜色为njust
\setbeamercolor{block title}{bg=njust,fg=white}
\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=black!85!white}
\setbeamercolor{title}{bg=njust, fg=white}
\setbeamercolor{subtitle}{bg=njust, fg=white}
\setbeamercolor{frametitle}{bg=njust, fg=white}
\setbeamercolor{structure}{fg=njust}



\newcommand{\reditem}[1]{\setbeamercolor{item}{fg=purple}\item #1}

% 缩放公式大小
\newcommand*{\Scale}[2][4]{\scalebox{#1}{\ensuremath{#2}}}

% 解决 font warning
\renewcommand\textbullet{\ensuremath{\bullet}}

% ---------------------------------------------------------------------
% flow chart
\tikzset{
    >=stealth',
    punktchain/.style={
        rectangle, 
        rounded corners, 
        % fill=black!10,
        draw=white, very thick,
        text width=6em,
        minimum height=2em, 
        text centered, 
        on chain
    },
    largepunktchain/.style={
        rectangle,
        rounded corners,
        draw=white, very thick,
        text width=10em,
        minimum height=2em,
        on chain
    },
    line/.style={draw, thick, <-},
    element/.style={
        tape,
        top color=white,
        bottom color=blue!50!black!60!,
        minimum width=6em,
        draw=blue!40!black!90, very thick,
        text width=6em, 
        minimum height=2em, 
        text centered, 
        on chain
    },
    every join/.style={->, thick,shorten >=1pt},
    decoration={brace},
    tuborg/.style={decorate},
    tubnode/.style={midway, right=2pt},
    font={\fontsize{10pt}{12}\selectfont},
}
% ---------------------------------------------------------------------

% code setting
\lstset{
    language=C++,
    basicstyle=\ttfamily\footnotesize,
    keywordstyle=\color{red},
    breaklines=true,
    xleftmargin=2em,
    numbers=left,
    numberstyle=\color[RGB]{222,155,81},
    frame=leftline,
    tabsize=4,
    breakatwhitespace=false,
    showspaces=false,               
    showstringspaces=false,
    showtabs=false,
    morekeywords={Str, Num, List},
}



%% preamble
\title[ Few Shot Segmentation]{ Few Shot Segmentation}
% \subtitle{The subtitle}
\author{Weihao Bo}
\institute[NJUST]{WeihaoBo@njust.edu.cn}
\date{October 18, 2023}
